#!/usr/bin/env python
from lwpgt.render2d import Maps

class IsoRender(Maps):
    def __init__(self, width=10, height=10):
        Maps.__init__(self, width, height)
    
    def Render(self, surface, camera):
        """render map on given surface"""
        for l in self.maplayers:
            for y in range(self.height):
                for x in range(self.width):
                    #get object from map
                    tile=l.GetTile(x, y)
                    #if there is a Entity on the map
                    if tile!=None:
                        #calculate draw position
                        xx=(x-y)*(tile.width/2)-tile.width
                        yy=((x-1)+(y-1))*(tile.height/2)-tile.height
                        tile.Draw(surface, (xx-camera.rect.x, yy-camera.rect.y))
